package com.hzhk.happyrent.ui.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * User: hzhk(1097282555@qq.com)
 * Date: 2017/11/21
 * Time: 18:14
 * progject: HappyRent
 * Describe： ${Describe}
 */
public abstract class BaseFragment extends Fragment {
    Unbinder unbinder;

    protected abstract View getContentView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState);

    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View contentView = getContentView(inflater, container, savedInstanceState);
        unbinder = ButterKnife.bind(this, contentView);
        ButterKnife.bind(this, contentView);
        return contentView;
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        if(unbinder!=null){
            unbinder.unbind();
        }
    }
}
